package com.yckj.day02;

import java.util.Scanner;

/**
 * if嵌套案例
 */
class  IfElseIfDemo2 {
	public static void main(String[] args) 	{
		//1. 从键盘上输入一个时间
		Scanner sc = new Scanner(System.in);
		System.out.println("请按hh  mm  ss的格式输入一个时间");
		int hour = sc.nextInt();		//小时
		int minute = sc.nextInt();		//分钟
		int second = sc.nextInt();		//秒


		//2. 计算 后一秒
		second++;								//second--
		//对时间进行修正
		if( second >= 60 ){						//if( second < 0 ) {
			//秒到了60秒之后 , 分钟加1, 秒置0
			second = 0;							//second = 59
			minute++;							//minute--;
			if( minute >= 60 ){					//if(minute<0){
				//分钟超过60, 分钟置0,小时加1
				minute = 0;						//minute=59;
				hour++;							//hour--
				if( hour >= 24 ){				//if( hour<0){
					hour = 0;					//hour=23
				}
			}
		}


		//3. 输出
		System.out.println("后一秒为" + hour + ":" + minute + ":" + second);

	}
}